<?php if ($success!=''){?>
<h4 class="alert_success"><?php echo $success;?></h4>
<?php }?>
<?php if ($error!=''){?>
<h4 class="alert_error"><?php echo $error;?></h4>
<?php }?>
<?php
?>

<h4 class="alert_info" style="line-height: 20px;padding-left: 5px;">
	Thời gian đăng ký:
<br/>
<?php
	echo "From: ".date('Y-m-d H:i:s',strtotime($toTime));
	echo "<br/>\n";
	echo "To: ".date('Y-m-d H:i:s',strtotime($endTime));
?>
</h4>
<?php
if (($toTime <= time()) && ($endTime > time())){
	if (!$user->cv){
?>
<h4 class="alert_error">Nhập đầy đủ thông tin cá nhân trước khi đăng ký thực tập.</h4>
<?php
	}else{
?>
<form action="<?php echo site_url();?>/internship/signup" method="POST" id="profile-form" enctype="multipart/form-data">
<article class="module width_half" style="margin-bottom: 20px;">
	<header>
		<h3 style="width: 50%;">Kết quả đăng ký</h3>
		<?php if(count($selected) == 0){?>
		<ul class="tabs">
   			<li class="active"><a href="#tab1">Mặc định</a></li>
    		<li><a href="#tab2">Tùy chọn</a></li>
		</ul>
		<?php }?>
	</header>
	<div class="module_content" id="tab1" style="display: block;">
		<fieldset>
			<label>Đăng ký lần đầu</label>
			<select id="company1" name="company" style="width:42%;height:24px;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;background-color: #fff;">
				<option value="0">Select...</option>
			<?php
			if (isset($companies) && is_array($companies))
			foreach ($companies as $company){
			?>
				<option value="<?php echo $company->id;?>"><?php echo $company->name;?></option>
			<?php
			}
			?>
			</select>
		</fieldset>
	</div>
	
	<div class="module_content" id="tab2" style="display: none;">
		<fieldset>
			<label>Công ty</label>
			<input type="text" name="company-custom" value="" style="width:40%;"/>
		</fieldset>
	</div>
	<footer>
		<div class="submit_link">
			<input type="hidden" name="type" id="type" value="1"/>
			<input type="submit" value="Sign-up" class="alt_btn">
			<input type="reset" value="Clear">
		</div>
	</footer>
</article>
</form>

<?php
	}
}else{?>
<?php 
} ?>

<script type="text/javascript">
$(function() {
	$('a[href="#tab1"]').click(function(){
		$('#tab1').show();
		$('#tab2').hide();
		$('#type').val(1);
	});
	$('a[href="#tab2"]').click(function(){
		$('#tab1').hide();
		$('#tab2').show();
		$('#type').val(2);
	});
	
	<?php
	for ($i=0; $i<count($selected);$i++){
	?>
	$('#company<?php echo ($i+1);?>').val(<?php echo $selected[$i];	?>);
	$('#company<?php echo ($i+1);?>').attr('disabled', 'disabled');
	<?php
	}
	?>
});
</script>